<?php if($this->_tpl->params->get('font_method') == 0) : ?>

    <?php 
        $document =& JFactory::getDocument();
        $document->addScript($this->templateurl() . '/js/cufon.js'); 
    ?>

	<?php if($this->_tpl->params->get('cufon_font') != -1 ) : ?>
        <?php $document->addScript($this->templateurl().'/fonts/'.$this->_tpl->params->get('cufon_font')); ?>
	<?php endif; ?>
	
	<?php if($this->_tpl->params->get('cufon_font1') != -1 ) : ?>
        <?php $document->addScript($this->templateurl().'/fonts/'.$this->_tpl->params->get('cufon_font1')); ?>
	<?php endif; ?>

	
	<script type="text/javascript">
	//<![CDATA[
		if(!window.ie || (document.querySelectorAll && window.ie)){
		<?php if($this->_tpl->params->get('cufon_font','-1') != '-1' ) : ?>
		Cufon.replace('body', { fontFamily: '<?php echo $this->_tpl->params->get('cufon_fontname',''); ?>' });
		<?php endif; ?>


		<?php 
		
			$cufon_fonts = array(
                '.cbBox h3',
            	'div.itemHeader h2.itemTitle',
            	'div.userItemHeader h3.userItemTitle',
            	'div.catItemHeader h3.catItemTitle', 
            	'div.genericItemHeader h2.genericItemTitle', 
            	'div.k2ItemsBlock ul li a.moduleItemTitle',
                'legend',
            	'.contentheading',
            	'.componentheading',
            	'h2.page_title',
            	'h2.latestItemTitleList',
            	'#container h1',
            	'.rcolumn h1',
            	'#nagl h3'		
			);		
		
			if($this->_tpl->params->get('cufon_font1','-1') != '-1' ) :
		?>		
			<?php foreach($cufon_fonts as $cfont) : ?>
			Cufon.replace('<?php echo $cfont; ?>', { fontFamily: '<?php echo $this->_tpl->params->get('cufon_font1name',''); ?>' });
			<?php endforeach; ?>
		<?php endif; ?>	
		}
	//]]>	
	</script>
<?php endif; ?>

<?php 

	if($this->_tpl->params->get('font_method') == 2) {
		if($this->getParam('google_font','none') != 'none'){
			echo '<link href="http://fonts.googleapis.com/css?family='.$this->getParam('google_font').'" rel="stylesheet" type="text/css" />';
		}
		
		if($this->getParam('google_font1','none') != 'none'){
			if($this->getParam('google_font1') != $this->getParam('google_font')){
				echo '<link href="http://fonts.googleapis.com/css?family='.$this->getParam('google_font1').'" rel="stylesheet" type="text/css" />';		
			}
		}
	}

?>

<?php
	
if($this->_tpl->params->get('font_method') == 3) {
	if($this->getParam('squirell_dirname','') != ''){
		echo '<link href="'. $this->templateurl() . '/fonts/' . $this->getParam('squirell_dirname') . '/stylesheet.css" rel="stylesheet" type="text/css" />';
	}

	if($this->getParam('squirell_dirname','') != $this->getParam('squirell_dirname1','')) {
		if($this->getParam('squirell_dirname1','') != ''){
			echo '<link href="'. $this->templateurl() . '/fonts/' . $this->getParam('squirell_dirname1') . '/stylesheet.css" rel="stylesheet" type="text/css"/>';
		}
	}
	
}	
	
?>

<style type="text/css">	

	body {
		font-family: <?php echo $this->fontFamily($this->getParam('font_family',1), $this->getParam('google_font','none'),''); ?>;
	}
	
    .cbBox h3,	
	div.itemHeader h2.itemTitle,
	div.userItemHeader h3.userItemTitle,
	div.catItemHeader h3.catItemTitle, 
	div.genericItemHeader h2.genericItemTitle, 
	div.k2ItemsBlock ul li a.moduleItemTitle,
    legend,
	.contentheading,
	.componentheading,
    h2.page_title, 
	h2.latestItemTitleList,
    #container h1, 
    .rcolumn h1, 
    #nagl h3 
	{
		font-family: <?php echo $this->fontFamily($this->getParam('font_family1',1), $this->getParam('google_font1','none'),'1'); ?>;
	}
</style>